//
//  OpenTimeController.m
//  CP20180523
//
//  Created by l wb on 2018/5/26.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "OpenTimeController.h"

@interface OpenTimeController ()
@property (weak, nonatomic) IBOutlet UILabel *salesTimeLab;
@property (weak, nonatomic) IBOutlet UILabel *openTime;
@property (weak, nonatomic) IBOutlet UILabel *titleLab;


@end

@implementation OpenTimeController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.navigationItem.title = @"开奖时间";
    
    [self getDataFromNet];
    
}
-(void)getDataFromNet{
    
    //{\"SFC\":\"1\"}
//    {"LotteryID"%3A"7"}
    NSString* paramsString = @"{\"LotteryID\":\"7\"}";
    AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc]init];
    NSLog(@"%@",paramsString);
    [manager GET:@"https://data.cp.lovedou.com/Handler.ashx" parameters:@{@"action":@"201",@"params":paramsString} progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        NSDictionary *dic = (NSDictionary *)responseObject;
        NSDictionary *data = dic[@"data"];
        NSLog(@"%@",dic);
        self.salesTimeLab.text = data[@"BuyEndTime"];
        self.openTime.text = [NSString stringWithFormat:@"今天%@",data[@"OpenTime"]];
        self.titleLab.text = data[@"Name"];
        
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        
    }];
}


#pragma mark -跳转到选号界面
- (IBAction)goSelectedNumberPageClickAction:(UIButton *)sender {
    [SelectionNumManager shared].currentLotteryID = @"7";
    [SelectionNumManager shared].currentLotteryName = @"11选5";
    
    UIViewController* acViewCon = [[UIStoryboard storyboardWithName:@"SelectedNumber" bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:@"Select11X5ViewController"];
    [self.navigationController pushViewController:acViewCon animated:YES];
    
}



@end
